// --------------------------------------------------------------------------------------------------------------------
// <copyright file="IStrategyModel.cs" company="Open Trader">
//   Copyright (c) David Denis (david.denis@systemathics.com)
// </copyright>
// <summary>
//   |  Open Trader - The Open Source Systematic Trading Platform
//   |
//   |  This program is free software: you can redistribute it and/or modify
//   |  it under the terms of the GNU General Public License as published by
//   |  the Free Software Foundation, either version 2 of the License, or
//   |  (at your option) any later version.
//   |
//   |  This program is distributed in the hope that it will be useful,
//   |  but WITHOUT ANY WARRANTY; without even the implied warranty of
//   |  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//   |  GNU General Public License for more details.
//   |
//   |  You should have received a copy of the GNU General Public License
//   |  along with this program.  If not, see http://www.gnu.org/licenses
//   |
//   |  Up to date informations about Open Trader can be found at :
//   |    http://opentrader.org
//   |    http://opentrader.codeplex.com
//   |
//   |  For professional services, please visit us at :
//   |    http://www.systemathics.com
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace Org.OpenTrader.Framework.Forge.Interfaces
{
    #region Using Directives

    using Org.OpenTrader.Framework.Forge.Enums;
    using Org.OpenTrader.Framework.Forge.Events;

    #endregion

    /// <summary>
    /// The i strategy model.
    /// </summary>
    public interface IStrategyModel
    {
        #region Properties

        /// <summary>
        /// Strategy Booking path
        /// </summary>
        string BookingPath { get; }

        /// <summary>
        /// Strategy Expo
        /// </summary>
        StrategyModelExpo Expo { get; }

        /// <summary>
        /// Strategy Type
        /// </summary>
        EStrategyTimeFrameType TimeFrame { get; }

        /// <summary>
        /// Trading Scope : Prod, Virtual or Test
        /// </summary>
        ETradingScope TradingScope { get; }

        /// <summary>
        /// Number of the Strategy Parameters
        /// </summary>
        int NbParams { get; }
        
        #endregion

        #region Indexers

        /// <summary>
        /// Get StrategyModelCell using index
        /// </summary>
        /// <param name="index"></param>
        /// <returns></returns>
        IStrategyModelCell this[int index]
        {
            get;
        }

        /// <summary>
        /// Get StrategyModelCell using name
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        IStrategyModelCell this[string name]
        {
            get;
        }

        #endregion

        #region Public Methods

        /// <summary>
        /// Add the secotor s to the strategy
        /// </summary>
        /// <param name="s">
        /// The s.
        /// </param>
        /// <returns>
        /// The add.
        /// </returns>
        bool Add(IStrategyModelCell s);

        /// <summary>
        /// Number of StrategyModelCell
        /// </summary>
        /// <param name="status">
        /// The status.
        /// </param>
        /// <returns>
        /// The nb.
        /// </returns>
        int Nb(EStrategyStatus status);

        /// <summary>
        /// OnFeed event
        /// </summary>
        /// <param name="sender">
        /// </param>
        /// <param name="args">
        /// </param>
        void OnFeed(object sender, FeedEventArgs args);

        /// <summary>
        /// OnOrder reply
        /// </summary>
        /// <param name="sender">
        /// </param>
        /// <param name="args">
        /// </param>
        void OnOrder(object sender, OrderTrackingEventArgs args);

        /// <summary>
        /// Synchronous Timer call (BackgroundWorker)
        /// </summary>
        void Run();

        /// <summary>
        /// Set Parameters
        /// </summary>
        /// <param name="key">
        /// name of the parameter : not empty
        /// </param>
        /// <param name="val">
        /// the value of the parameter : not empty
        /// </param>
        /// <returns>
        /// The set param.
        /// </returns>
        bool SetParam(string key, Table.Cell val);

        /// <summary>
        /// Start StrategyModelCell using index
        /// </summary>
        /// <param name="index">
        /// The index.
        /// </param>
        /// <returns>
        /// The start.
        /// </returns>
        bool Start(int index);

        /// <summary>
        /// Start StrategyModelCell using name
        /// </summary>
        /// <param name="name">
        /// The name.
        /// </param>
        /// <returns>
        /// The start.
        /// </returns>
        bool Start(string name);

        /// <summary>
        /// Start All StrategyModelCell
        /// </summary>
        /// <param name="id">
        /// </param>
        /// <returns>
        /// The start.
        /// </returns>
        int Start();

        /// <summary>
        /// Stop StrategyModelCell using index
        /// </summary>
        /// <param name="index">
        /// The index.
        /// </param>
        /// <returns>
        /// The stop.
        /// </returns>
        bool Stop(int index);

        /// <summary>
        /// Stop StrategyModelCell using index
        /// </summary>
        /// <param name="name">
        /// The name.
        /// </param>
        /// <returns>
        /// The stop.
        /// </returns>
        bool Stop(string name);

        /// <summary>
        /// Stop All StrategyModelCell
        /// </summary>
        /// <param name="id">
        /// </param>
        /// <returns>
        /// The stop.
        /// </returns>
        int Stop();

        #endregion
    }
}